<template>
  <div class="user-collection-container">
    <div class="header">
      <van-nav-bar
        title="收藏"
        left-text="返回"
        left-arrow
        @click-left="$router.back()"
      />
    </div>

    <div class="collection-contaner">
      <ul class="good-category-list">
        <li
          v-for="card in collectGoodsList"
          :key="card.id"
          @click="$router.push(`/goodsDetail?id=${card.id}`)"
        >
          <van-image lazy-load :src="card.list_pic_url" class="lazy-img" />
          <!-- <img :src="card.list_pic_url" alt="" /> -->
          <div class="good-list-text">
            <p class="title">{{ card.name }}</p>
            <p class="price">&yen; {{ card.retail_price }}</p>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { listAction } from "@/api/user";
export default {
  data() {
    return {
      collectGoodsList: [],
      
    };
  },
  methods: {
    async getdata() {
      let res = await listAction({ openId: localStorage.getItem("openId") });
      this.collectGoodsList = res.collectGoodsList;
    },
  },
  mounted() {
    this.getdata();
  },
};
</script>

<style scoped lang='scss'>
.user-collection-container {
  height: calc(100vh - 108px);
  background-color: #f8f8f8;
  .header {
    height: 81px;
    padding-bottom: 20px;
    ::v-deep .van-nav-bar {
      height: 100%;
      .van-nav-bar__content {
        height: 100%;
      }
      .van-nav-bar__text {
        font-size: 31.2px;
        color: #666666;
        letter-spacing: 0;
        font-weight: 400;
      }
      .van-icon {
        width: 30px;
        height: 30px;
        color: #000;
      }
      .van-nav-bar__title {
        font-size: 36px;
        color: #333333;
        letter-spacing: 0;
        font-weight: 500;
      }
    }
  }
  .collection-contaner {
    padding: 38px 20px 0 20px;
  }
  .good-category-list {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    li {
      height: 490px;
      width: 350px;
      .lazy-img{
        background-color: #fff;
      }
      .good-list-text {
        height: 140px;
        padding-top: 17px;
        text-align: left;
        .title {
          font-size: 26px;
          color: #333333;
          letter-spacing: 0;
          font-weight: 500;
          margin-bottom: 5px;
          @include dot;
        }
        .price {
          font-size: 26px;
          color: #9e4242;
          letter-spacing: 0;
          font-weight: 400;
        }
      }
    }
  }
}
</style>